<ion-view view-title="历史采购单" show-tabs>
    <ion-nav-buttons side="right">
    	<a class="button button-icon ion-android-add" href="#purchase/create-order"></a>
    </ion-nav-buttons>

    <ion-content class="wrap-light">
    	<section class="row text-center icon-legend">
    		<div class="col" ng-repeat="su in stateUi">
    			<i class="icon button-icon {{su.icon}} {{su.color}}"></i>
    			<div>{{su.text}}</div>
    		</div>

    	</section>
		<ion-list class="order-list" ng-repeat="date in orderList">
			<ion-item class="item item-divider">
			    {{date.divider}}
			</ion-item>
			<ion-item class="item" href="#purchase/order-{{order._id}}" ng-repeat="order in orderList[$index].list">
				<div class="row row-center">
					<i class="icon button-icon {{stateUi[order.state].icon}} {{stateUi[order.state].color}}"></i>
					<div class="col">
						<p>单号: {{order.order_no}}</p>
						<div class="meta">{{order.supplier.company}}</div>
					</div>
					<div class="col-bottom text-right" ng-class="{'assertive':order.paid==0,'royal':(order.total_cost>order.paid && order.paid!=0)}">{{order.total_cost | currency:'￥'}}</div>

				</div>
				<div class="corner-large" ng-if="order.return" ng-class="{'royal-bg':order.return.state=='部分退','assertive-bg':order.return.state=='全退'}">{{order.return.state}}</div>
			</ion-item>
		</ion-list>
	</ion-content>
</ion-view>
